home *** CD-ROM | disk | FTP | other *** search
- /* $VER: GoFetchRexx.ttx 1.2 (24.2.96)
- **
- ** ARexx script to invoke FetchRefs from TurboText.
- **
- */
-
- OPTIONS RESULTS
- caller = ADDRESS()
-
- /* Static part of the ARexx port name of the editor. That is, the name before
- * any suffixes (like '.1') are appended.
- */
- editorname = 'TURBOTEXT'
-
- /* Exit if we're not called from the editor */
- IF (LEFT(caller, LENGTH(editorname)) ~= editorname) then
- EXIT 10
-
- /* Get the current word from the editor, reading char by char */
- 'SetDisplayLock ON'
-
- position = 0
- function = ''
- 'GetChar'
- char = result
- DO WHILE VERIFY(char, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890_") = 0
- function = function || char
- 'MoveRight'
- position = position + 1
- 'GetChar'
- char = result
- END
- DO WHILE position > 0
- 'MoveLeft'
- position = position - 1
- END
-
- 'SetDisplayLock OFF'
-
- /* It doesn't matter whether we want a taglist, varargs og whatever function */
- IF RIGHT(function, 7) = "TagList" THEN
- function = LEFT(function, LENGTH(function) - 7)
- ELSE IF RIGHT(function, 4) = "Tags" THEN
- function = LEFT(function, LENGTH(function) - 4)
- ELSE IF RIGHT(function, 1) = "A" THEN
- function = LEFT(function, LENGTH(function) - 1)
-
- /* Define a temporary filename to put the reference into */
- filename = 'T:FR_' || function
-
- /* Now actually get the reference */
- ADDRESS 'FETCHREFS'
- FR_GET function || '(%|Tags|TagList|A)' filename FILEREF
- gotoline = rc2
-
- /* Address editor again to load the file or report error */
- ADDRESS VALUE caller
-
- IF rc ~= 0 THEN DO
- /* Some kind of error happend. Report it. This may be a simple
- * "Aborted" or "No reference" message.
- */
- 'SetStatusBar Temporary' rc2
-
- EXIT 0
- END
- ELSE DO
- /* Make the editor open a new window and load the autodoc into it. */
- 'OpenDoc NAME' filename
- docPort = result
- ADDRESS VALUE docPort
- 'SetDisplayLock ON'
-
- /* Jump to the suggested line */
- IF gotoline ~= 0 THEN
- 'Move FOLDS' gotoline
-
- 'SetDisplayLock OFF'
-
- /* Delete the temporary file */
- ADDRESS COMMAND 'C:Delete >NIL:' filename
-
- EXIT 0
- END
-
-